package com.example.demo.controller;

import com.example.demo.entity.DeliveryOrder;
import com.example.demo.entity.DriverInfo;
import com.example.demo.service.DeliveryOrderService;
import com.example.demo.service.DriverInfoService;
import com.example.demo.util.GetMessage;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/driver")
@RequiredArgsConstructor
@Component
public class DriverInfoController {
    private  final DriverInfoService driverInfoService;
    @CrossOrigin(origins ="*" ,maxAge = 3600)
    @GetMapping("/select")
    public GetMessage select (String name)  {
        List<DriverInfo> list=driverInfoService.select(name);

        return new GetMessage("成功","200",list);
    }
}
